package com.gitee.wsl.mathematics.number

import com.gitee.wsl.ext.number.clamp


interface FloatCalcContainer: NumberCalcContainer<Float> {
    override val zero: Float
        get() = 0f
    override val NaN: Float
        get() = Float.NaN
    override val POSITIVE_INFINITY: Float
        get() = Float.POSITIVE_INFINITY
    override val NEGATIVE_INFINITY: Float
        get() = Float.NEGATIVE_INFINITY
    override val MAX_VALUE: Float
        get() = Float.MAX_VALUE
    override val MIN_VALUE: Float
        get() = Float.MIN_VALUE

    override fun Float.divBy(a: Number): Float = a.toFloat() / this

    override fun Float.rem(a: Number): Float = this % a.toFloat()

    override fun Float.remBy(a: Number): Float = a.toFloat() % this

    override fun sin(a: Float): Float= kotlin.math.sin(a)

    override fun asin(a: Float): Float = kotlin.math.asin(a)

    override fun cos(a: Float): Float= kotlin.math.cos(a)

    override fun abs(a: Float): Float = kotlin.math.abs(a)

    override fun sign(a: Float): Float = kotlin.math.sign(a)

    override fun ceil(a: Float): Float = kotlin.math.ceil(a)

    override fun floor(a: Float): Float = kotlin.math.floor(a)

    override fun round(a: Float): Float = kotlin.math.round(a)

    override fun sqrt(a: Float): Float = kotlin.math.sqrt(a)

    override fun acos(a:Float): Float = kotlin.math.acos(a)

    override fun atan2(a: Float, b: Float): Float = kotlin.math.atan2(a,b)

    override fun tan(a: Float): Float = kotlin.math.tan(a)

    override fun isFuzzyZero(a:Float): Boolean =  com.gitee.wsl.ext.number.isFuzzyEqual(a,0f)

    override fun isFuzzyEqual(a: Float, b: Float): Boolean = com.gitee.wsl.ext.number.isFuzzyEqual(a,b)

    override fun min(a:Float,b:Float): Float = kotlin.math.min(a,b)

    override fun max(a:Float,b:Float): Float = kotlin.math.max(a,b)

    override fun Number.plus(x: Number): Float = toFloat() +x.toFloat()

    override fun Number.minus(x: Number): Float = toFloat() -x.toFloat()

    override fun Number.times(x: Number): Float = toFloat() * x.toFloat()

    override fun Number.div(x: Number): Float = toFloat() / x.toFloat()

    override fun Number.unaryMinus(): Float = -toFloat()

    override fun Number.unaryPlus(): Float = +toFloat()


    override fun clamp(r:Float, a: Float, b: Float):Float = r.clamp(a,b)

    override fun hypot(a: Float, b: Float): Float = kotlin.math.hypot(a,b)

    override fun Float.inRange(start: Float, end: Float): Boolean = this in start..end

    override fun Float.inRangeOpen(start: Float, end: Float): Boolean= this in start ..< end

    override fun mapValue(
        start1: Float,
        stop1: Float,
        start2: Float,
        stop2: Float,
        value: Float,
        withBounds: Boolean,
    ): Float = com.gitee.wsl.ext.number.map(start1, stop1, start2, stop2, value,withBounds)
}